package www.dashu.com.domain;

import www.dashu.com.domain.base.BaseVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.Formula;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;

@Data
@Entity
@Table(name="c_product_attribute_category")
public class CProductAttributeCategory extends BaseVo implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("")
    @Id
    private Long id;

    @ApiModelProperty("名称")
    @Column(name = "name")
    private String name;

    @ApiModelProperty("属性数量")
    @Column(name = "attribute_count")
    private Integer attributeCount;

    @ApiModelProperty("所属商户")
    @Formula("(select s.name from sys_company s where s.id = company )")
    private String companyName;

    @Column(name = "company")
    private Long company;

    @ApiModelProperty("")
    @Formula("(select s.name from sys_app s where s.id = app_id )")
    private String appName;

    @Column(name = "app_id")
    private Long appId;

    @ApiModelProperty("创建时间")
    @Column(name = "create_time")
    private Date createTime;

    @ApiModelProperty("更新时间")
    @Column(name = "update_time")
    private Date updateTime;


    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", name=").append(name);
        sb.append(", attributeCount=").append(attributeCount);
        sb.append(", company=").append(company);
        sb.append(", appId=").append(appId);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append("]");
        return sb.toString();
    }

}